function groupby(arr, groupFn, formatFn) {
  if (Array.isArray(arr)) {
    new Error('参数不合法')
  }
  let group = {};
  for (let item of arr) {
    let key = groupFn(item)
    let val = formatFn ? formatFn(item) : item;
    let target = group[key]
    if (!target) {
      group[groupKey] = [val];
    } else {
      target.push(val);
    }
  }
}

export default groupby